import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: zhonyisheng
 * Date: 2024-05-07
 * Time: 15:04
 */
public class Test {
    public static void main(String[] args) {
        int a=24;
        int b=18;
        int c=a%b;
        while(c!=0){
            a=b;
            b=c;
            c=a%b;
        }
        System.out.println(b);
    }

    public static void main6(String[] args) {
//        计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值   
        double sum=0F;
        int flag=1;
        for (double i = 1F; i < 100F; i++) {
            sum+=1.0/i*flag;
            flag*=-1;
        }
        System.out.println(sum);
    }

    public static void main5(String[] args) {
        for (int i = 0; i < 99999; i++) {
            int count = 0;
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10, count);
                tmp /= 10;
            }
            if (sum == i)
                System.out.println(i);
        }
    }

//        int num=0;   好差
//        int ret=0;
////        Scanner in = new Scanner(System.in);
////        while(in.hasNextInt())
//            int n = in.nextInt();
//            for (int i = 2; i < n; i++) {
//                while(i==0){
//                    ret=i%10;
//                    num+=ret*ret*ret;
//                    ret=i/10;
//                }
//                if(num==i)
//                    System.out.println(i);
//                num=0;
//            }



    public static void main4(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n= in.nextInt();
            for(int i=0;i<n;i++){
                for(int j=0;j<n;j++){
                    if(i == j || (i+j)==(n-1)){
                        System.out.print("*");
                    }else{
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    //    给定一个数字，判定一个数字是否是素数
    public static void main3(String[] args) {
        int n = 14;
        boolean flag=true;
        for (int i = 2; i < n; i++) {
            if(n%i == 0){
                flag=false;
                break;
            }
        }
        if(flag){
            System.out.println("是素数："+n);
        }
        else{
            System.out.println("不是素数"+n);
        }

    }

    //    public static void main2(String[] args) {
//        int n = 13;
//        int i=2;
//        fori
//
//    }
    //    编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static void main1(String[] args) {
        int count =0;
        for (int i = 1; i <= 100; i++) {
            if (i % 10 == 9)
                count++;
            if (i / 10 == 9)
                count++;
        }
        System.out.println(count);
    }
}
